package com.mini.game;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.Display;
import android.view.WindowManager;

import com.draw.b.ColorB;

public class GameBox {
	
	private int width = 270;
	private int hight = 400;
	private Bitmap bitmap;
	private int boxx;
	private int boxy;
	private int boxid;
	private static int countbox=1;
	private Context context;
	private int velx;
	private int vely;	
	
	

	public GameBox(Context context, int cordx, int cordy) {
		// TODO Auto-generated constructor stub
		
		BitmapFactory.Options bitmapFactory = new BitmapFactory.Options();
		bitmapFactory.inJustDecodeBounds = true ;	

		countbox = boxid;
		countbox++;
		
		velx = 35;
		vely = 35;
		
		boxx = cordx;
		boxy = cordy;
		
		WindowManager windowmanger = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
		Display display = windowmanger.getDefaultDisplay();
		display.getHeight();
		display.getWidth();
		
		width = display.getWidth();
		hight = display.getHeight();
		
	}

	public void setVelx(int x){
		velx = x;
	}
	
	public void setVely(int y){
		vely = y;
	}
	
	public void setboxx(int x){
		boxx = x;
	}
	
	public void setboxy(int y){
		boxy = y;
	}
	
	public void onMove(int x,int y,GameBox gbox){
		if(boxx >= width){
			boxx-= velx;
			boxy-= vely;
			velx = -velx;
			
		}
		
		if(boxy >= hight){
			boxy-= vely;
			boxx-= velx;
			vely = -vely;
		}
		
		if(boxx <= 0 ){
			boxx-= velx;
			boxy-= vely;
			velx = -velx;

		}
		
		if(boxy <= 0){
			boxy-= vely;
			boxx-= velx;
			vely = -vely;
		}
		

		boxx += velx;
		boxy += vely;
		
	}
	
	public int getVelx(){
		return velx;
	}
	
	public int getVely(){
		return vely;
	}
	
	public int getboxx(){
		return boxx;
	}
	
	public int getboxy(){
		return boxy;
	}
	
	public Bitmap getBit(){
		return bitmap;
	}
	
	public int getId(){
		return boxid;
	}


	}


